Skip to content

Design token metrics#694

Draft
GarthDB wants to merge 1 commit intomainfrom
cursor/design-token-metrics-a85c
Draft

Design token metrics#694
GarthDB wants to merge 1 commit intomainfrom
cursor/design-token-metrics-a85c

Conversation

@GarthDB
Copy link
Member

@GarthDB GarthDB commented Feb 6, 2026

Description

This PR introduces a new CLI tool located at tools/token-metrics to extract and report quantitative metrics from @adobe/spectrum-tokens. The tool provides a comprehensive baseline analysis of the design token system, covering inventory, scope, architecture, data quality, and component coverage. It generates both a human-readable summary (printed to stdout) and a machine-readable JSON report (token-metrics-report.json).

Related Issue

This addresses the Spectrum OKR: "Token metrics are defined and included into our metrics system & have a baseline to compare moving forward." Specifically, it provides a concrete answer to Alison's question: "what does this mean specifically, and when should this be done by?"

Motivation and Context

The primary motivation is to establish a clear, quantifiable understanding of the current state of Spectrum's design token system. This baseline is crucial for:

  • Tracking the health, maturity, and growth of tokens over time.
  • Identifying areas for improvement (e.g., deprecation migration path coverage).
  • Enabling data-informed decisions for future token development and governance.
  • Providing transparency and accountability for the "Token metrics" OKR.

How Has This Been Tested?

  • Unit Tests: Comprehensive unit tests (tools/token-metrics/test/index.test.js) cover all core utility functions and metric computations.
  • Integration Test: An integration test runs computeMetrics against the actual packages/tokens/src directory to ensure real-world data processing.
  • Manual Execution: The CLI tool was executed locally to generate the token-metrics-report.json and verify the summary output.

Screenshots (if appropriate):

N/A (CLI tool, output is text/JSON). The generated token-metrics-report.json serves as an example output.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Open in Cursor Open in Web

Add a new tool at tools/token-metrics that extracts quantitative metrics
from @adobe/spectrum-tokens to support the OKR: 'Token metrics are
defined and included into our metrics system & have a baseline to
compare moving forward.'

Metrics extracted from the current token data:
- Token inventory: 2,338 total (2,150 active, 188 deprecated)
- Token scope: 965 global, 1,373 component-scoped across 95 components
- Architecture: 654 aliases, 459 direct-value, 1,225 set-based
- Data quality: 100% UUID coverage, max alias depth 4
- Component coverage: 44/54 registered components have tokens (81.5%)
- Semantic categories: layout (741), content (289), typography (284),
  color (227), background (151), border (58), shadow (23)

Includes:
- src/index.js: Core metrics extraction library with exported functions
- src/cli.js: CLI tool for generating reports
- test/index.test.js: 21 unit and integration tests (all passing)
- README.md: Documents all metrics, their meaning, and recommended
  timeline for Alison and the team
- token-metrics-report.json: Baseline snapshot from current data
- moon.yml, ava.config.js, package.json: Standard tooling config
@cursor
Copy link

cursor bot commented Feb 6, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

⚠️ No Changeset found

Latest commit: f68c4a5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@GarthDB
Copy link
Member Author

GarthDB commented Feb 6, 2026

Run report for f68c4a5b

Total time: 7.1ms | Comparison time: 0s | Estimated loss: 7.1ms (100.0% slower)

Action Time Status Info
🟩 SyncWorkspace 7ms Passed
Touched files
pnpm-lock.yaml
tools/token-metrics/README.md
tools/token-metrics/ava.config.js
tools/token-metrics/moon.yml
tools/token-metrics/package.json
tools/token-metrics/src/cli.js
tools/token-metrics/src/index.js
tools/token-metrics/test/index.test.js
tools/token-metrics/token-metrics-report.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants